package com.example.domain.vo;

import lombok.Data;

/**
 * 统一结果返回类
 */
@Data
public class Result {

    /**
     * 响应状态码
     */
    private Integer code=200;
    /**
     * 响应提示信息
     */
    private String msg="OK";
    /**
     * 响应数据
     */
    private Object data;

    public Result(){

    }

    public Result(Integer code, String msg){
        this.code=code;
        this.msg=msg;
    }

    public Result(Object data){
        this.data=data;
    }

    public static Result ok(){
        return new Result();
    }

    public static Result ok(String msg){
        return new Result(200, msg);
    }

    public static Result ok(Object data){
        return new Result(data);
    }

    public static Result error( String msg){
        return new Result(-1, msg);
    }
}
